package com.tgy.override;

import javax.imageio.IIOException;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;

/**
 * @Author: tgy
 * @Date: 12/3/20 5:02 PM
 */

class Person{


    protected Number say(String str) throws Exception {

        return str.hashCode();
    }

}

/**
 *
 * 方法重写的规则
 *
 * 两小两同一大
 * 两小: 子类重写方法的返回值必须是父类方法返回值的同类或者子类，异常也是一样
 * 两同: 方法名和参数必须相同
 * 一大: 访问控制符必须大于或者等于父类的方法访问控制符
 */
class Student extends Person{

    @Override
    protected Integer say(String str) throws IIOException {

        return str.hashCode();
    }
}

public class Demo01 {

    public static void main(String[] args) {


//        try {
//
////            System.exit(1);
//
//            System.out.println(111);
//            return;
//        }finally {
//            System.out.println("1111");
//
//            return;
//        }

        System.out.println(test());

        try {
            InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(""));

            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static int test() {

        try {

            return 2;
        }finally {

            return 1;
        }

    }
}
